home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ Infotip Files.xpl < prev    next >
Text File  |  2002-07-13  |  6KB  |  212 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="8"
  3. "COUNT"="2"
  4. "UIPATH"="Appearance\Files&Folders\Files ToolTips"
  5. "NAME"="Edit File ToolTips"
  6. "VERSION"="1.02"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="Change"
  9. "TEXT 2"="Delete"
  10. "OSVERSION"="0001011"
  11. "DESCRIPTION 1"="If you point the mouse-cursor to a file and wait about two seconds, Windows is able to display a little yellow window (ToolTip) that shows some information about that file. This way, you know what the file is about without open it."
  12. "DESCRIPTION 2"="This plug-in allows you to customize those ToolTips or remove them. Just select the file in question and select "Change" to change the ToolTip that should appear, or "Delete" to remove the ToolTip. If the file you want to change does not appear in this list, use the "Add File ToolTip" plug-in."
  13. "DESCRIPTION 3"="You can either define a custom static message like "This is a XQZ file" or let Windows display the document properties for that file: "prop:FileDescription;Company;FileVersion;Create;Size". If the ToolTip starts with "prop:", Windows will display the document properties. Hint: To see the available properties, just right-click a file and select the "Properties" tab."
  14. "DESCRIPTION 4"="NOTE: This plug-in allows you to change the "simple ToolTips" only. Windows does also allow executing a program that displays the ToolTip (for example, WinZIP does this for ZIP, CAB etc. files). Since this procedure varies from program to program, this plug-in will NOT display these non-simple ToolTips and does also NOT allow you to change those ToolTips. "
  15. "AUTHOR"="Xteq Systems"
  16. "CONTACTURL"="http://www.xteq.com"
  17. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  18. "COMMENT 1"="Bloody complicated plug-in!!!"
  19.  
  20.  
  21. sP="HKLM\Software\Classes\"
  22.  
  23. dim iItems        'contains the total amount of the registry keys
  24. Dim aryItems()    'contains the name of the Registry paths (direct files starting with ".")
  25. Dim aryItemsLoc() 'contains the registry location  (\ShellNew or \ShellNew-)
  26. Dim aryDesc()     'contains the description of the items
  27.  
  28.  
  29. Sub Plugin_Initialize 
  30.  if RegPathExists(sP) then
  31.     Call ReadRegistry
  32.  else
  33.     Call Disable
  34.  end if
  35. End Sub
  36.  
  37.  
  38. Sub ReadRegistry
  39.     iItems=RegEnumPaths(sP) 
  40.  
  41.     dim aryTemp
  42.     ReDim aryTemp(iItems)
  43.     dim aryTemp2
  44.     ReDim aryTemp2(iItems)
  45.  
  46.     l=1
  47.     e=1
  48.  
  49.     sDebug=""
  50.  
  51.     'read all data from the path
  52.     For l=1 to iItems       
  53.         sItem=RegEnumElement(l)    
  54.  
  55.         if left(sItem,1)="." then
  56.            s=HasInfoTip(sP, sP & sItem)
  57.  
  58.            If len(s)>0 then
  59.               sDebug=sDebug & sItem
  60.               aryTemp(e)=sItem
  61.               aryTemp2(e)=s
  62.               e=e+1
  63.            end if                
  64.         end if
  65.     next
  66.     'Call DebugMsg(sDebug)
  67.  
  68.  
  69.  
  70.     'okay, now count how many items we have left (that are not empty)...
  71.     iItems=0
  72.     for l=1 to e-1
  73.         If Len(aryTemp(l))>0 then
  74.            iItems=iItems+1
  75.         end if 
  76.     next 
  77.  
  78.     'redim final arrays with this value
  79.     ReDim aryItems(iItems)
  80.     ReDim aryItemsLoc(iItems)
  81.     ReDim aryDesc(iItems)
  82.  
  83.    
  84.     'copy from temp array to the final ones
  85.     i=1
  86.     for l=1 to e-1
  87.         If Len(aryTemp(l))>0 then
  88.            aryItems(i)=aryTemp(l)
  89.            aryItemsLoc(i)=aryTemp2(l)
  90.            i=i+1
  91.         end if
  92.     next
  93.  
  94.     'fill third array with the file description
  95.     for l=1 to iItems
  96.         aryDesc(l)=GetFileDescription(aryItems(l))
  97.     next 
  98.  
  99.     'AND NOW update the UI
  100.     for l=1 to iItems
  101.         Call SetUIElement(l,aryDesc(l) & " (" & aryItems(l) & ")") 'set data in X-Setup
  102.         if Right(aryItemsLoc(l),1)<>"-" then 'not disabled
  103.            Call SetUIElementEx(l,true) 'set activated
  104.         else
  105.            Call SetUIElementEx(l,false) 'set not active
  106.         end if
  107.     Next
  108. End Sub
  109.  
  110.  
  111. 'VERSION 1.1
  112. 'returns the readable description for a file TYPE. Input is the
  113. 'raw file type (e.g. ".TXT"). 
  114. Function GetFileDescription(DotType)
  115.   sxd_BasePath="HKLM\Software\Classes\"
  116.  
  117.   sxd_Path=sxd_BasePath & DotType & "\@"
  118.   sxd_Val=RegReadValue(sxd_Path)
  119.  
  120.   if IsEmpty(sxd_Val)=true then
  121.      'extended description not found! return default
  122.      GetFileDescription="<UNKNOWN>"
  123.   else
  124.      'found, now get the "real" description
  125.      sxd_Path=sxd_BasePath & sxd_Val & "\@"
  126.      sxd_Name=RegReadValue(sxd_Path)
  127.      
  128.      if IsEmpty(sxd_Name)=true then
  129.         'argh! 
  130.         GetFileDescription="<UNKNOWN>"
  131.      else
  132.         GetFileDescription=sxd_Name
  133.      end if
  134.   end if
  135.  
  136. End Function
  137.  
  138.  
  139. 'VERSION 1.0
  140. 'returns the reg path to the InfoTip value path or "" if nothing was found. Input is the
  141. 'path to the data type (e.g. "HKCR\.TXT"). 
  142. Function HasInfoTip(StartPath,Path)
  143.  Dim sCheck,sReturn
  144.  xd_sV_InfoTip="\InfoTip"
  145.  sReturn=""
  146.  
  147.  'first check if this file has a name. If so
  148.  'read the data from that name
  149.  s=RegReadValue(Path & "\@")
  150.  if IsEmpty(s)=false then          
  151.     '<default path>\.XXX File\InfoTip
  152.     sCheck=StartPath & s & xd_sV_InfoTip
  153.     if RegValueExists(sCheck) then
  154.        sReturn=sCheck
  155.     end if
  156.  else
  157.     'okay, seems this file has no name
  158.     sCheck=Path & xd_sV_InfoTip
  159.     if RegValueExists(sCheck) then
  160.        sReturn=sCheck
  161.     end if
  162.  end if
  163.  
  164.  HasInfoTip=sReturn
  165. End Function
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  173.  bChanged=false
  174.  
  175.  if ElementSubIndex>0 then
  176.  
  177.     if ElementIndex=1 then 'change
  178.        sCurPath=aryItemsLoc(ElementSubIndex)
  179.        s=RegReadValue(sCurPath)         
  180.        s=InputWindow("Please enter the ToolTip for that file e.g. <This is a XQZ file> or a <prop:xxx> string",s,1) 
  181.        if IsEmpty(s)=false then
  182.           Call RegWriteValue(sCurPath,s,1)
  183.           bChanged=true 
  184.        end if
  185.     end if
  186.  
  187.     if ElementIndex=2 then 'delete
  188.        sCurPath=aryItemsLoc(ElementSubIndex)
  189.        Call RegDeleteValue(sCurPath)
  190.        bChanged=true
  191.     end if
  192.      
  193.  
  194.     if bChanged=true then
  195.        'call the holy Windows API
  196.        Call IndicateSettingChange()
  197.  
  198.        're-read UI
  199.        Call ReadRegistry
  200.     end if
  201.  
  202.  else
  203.     Call MsgWarning("Please select an item in the list.")
  204.  end if
  205.  
  206. End Sub
  207.  
  208.  
  209.  
  210. Sub Plugin_Terminate 
  211. End Sub
  212.